package com.weipt.juc.function;

import java.util.function.Supplier;

/**
 * @author peter.wei 2020/09/28 14:13
 * @version 1.0
 * @company 终生学习
 * @description <br>peter.wei 2020/09/28 14:13
 **/
public class TestSupplier {
    public static void main(String[] args) {
        Supplier<String> innerSupplier = new Supplier<String>() {
            @Override
            public String get() {
                return "ok";
            }
        };
        System.out.println(innerSupplier.get());

        //lambda实现
        Supplier<String> supplier = ()->"ok";
        System.out.println(supplier.get());

        test(()->"ok");
    }



    private static void test(Supplier<String> stringSupplier){
        System.out.println(stringSupplier.get());
    }
}